package com.xintool.window.Buttons;

import com.xintool.window.Windows.Window_sxkz;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Button_sxkz extends ButtonFactory{

    @Override
    public JButton showButton(){

        // 利用按钮工厂创建按钮实例
        JButton button_sxkz = ButtonFactory.getButton("属性克制");//按钮显示文本为“属性克制”

        //添加点击事件监听
        button_sxkz.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // 点击按钮时创建并显示新窗口
                Window_sxkz newWindow = Window_sxkz.getWindow();
                if (!newWindow.isVisible()) {
                    newWindow.setVisible(true);
                }
            }
        });
        return button_sxkz;
    }
}
